package com.sharemarking.wa.common.exception;



import com.sharemarking.wa.common.ResponseParams;
import com.sharemarking.wa.common.SysHttpStatus;
import org.springframework.http.HttpStatus;

/**
 * Created by king on 2018/06/11.
 * 授权异常/登录异常 401 _token失效，需要重新登陆
 */
public class AuthException extends  Exception {

    private static final long serialVersionUID = 1L;

    public static final HttpStatus HTTPSTATUS = HttpStatus.UNAUTHORIZED;

    private ResponseParams<?> responseParams;
    
    private AuthException() {
    		
    }

    public ResponseParams<?> getResponseParams() {
        return responseParams;
    }
    
    public static AuthException create(ResponseParams<?> responseParams) {
    		AuthException re=new AuthException();
    		if(responseParams==null) {
    			responseParams=ResponseParams.error(SysHttpStatus.ERROR);
    		}
    		re.responseParams=responseParams;
    		return re;
    }
}
